<?php 
	$page = getRequest('p',1);
	$psize = getRequest('ps',15);
	$lastId = getRequest('lid');
	$type = getRequest('t');

	$auto_sql = 'select `ID`,`display_name` from `'.$prefix.'_users`';
	$auts = $db->query($auto_sql);
	$authors = array();
	foreach ($auts as $v){
		$authors[$v['ID']] = $v['display_name'];
	}
	
	$where = 'where `post_status`="publish" and `post_type`="post"';
	if(!empty($lastId))$where .= ' and `ID`>'.$lastId;
	
	$limit = ' limit '.($page-1)*$psize.','.$psize;
	
	$sql = 'select `ID`,`post_author`,`post_date`,`post_title` from `'.$prefix.'_posts` '.$where.' order by `post_date` desc'.$limit;
	$title = $db->query($sql);
	if(count($title)<1)exit(retJson(0,'empty'));
	$ret = array();
	$i = 0;
	$preg = '/style=".*?"/i';
	foreach ($title as $value) {
		$ret[$i]['id'] = $value['ID'];
		$ret[$i]['title'] = preg_replace($preg,'',$value['post_title']);
		$ret[$i]['author'] = $authors[$value['post_author']];
		$ret[$i++]['date'] = $value['post_date'];
	}
	
	exit(retJson(1,$ret));
?>
	
	
	
	